﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Pass3_1 : MonoBehaviour
{
    public CircleConnector[] circleConnectors;
    public int index = 0;
    public Animator redLightAni;
    public GameObject TRUEImg;


    public void Check()
    {
        for (int i = 0; i < circleConnectors.Length; i++)
        {
            if (circleConnectors[i].Check()) index++;

        }

        if (index >= circleConnectors.Length)
        {
            //播放动画
            Debug.Log("播放");
            redLightAni.enabled = true;
            TRUEImg.SetActive(true);
            //播放完成后通关提示
            StartCoroutine(TimeAction(3, () => { EduCoderTool.WebConnecter.Singleton.SendResultToWeb(true); }));
        }
    }

    IEnumerator TimeAction(float time, System.Action action)
    {
        yield return new WaitForSeconds(time);
        action.Invoke();
    }


}
